﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace ExtractFiles
{
    public partial class HowToMergeFiles : HowtoParent
    {
        private int currentPage = 1;
        private int firstPage = 2;
        private int maxPage = 6;

        public HowToMergeFiles()
        {
            InitializeComponent();
        }

        protected override void howToSearchFilesPrevBtn_Click(object sender, EventArgs e)
        {
            if (currentPage == firstPage)
            {
                displayFirstPageControls();
            }
            else
            {
                displayNormalPageControls();
            }
            currentPage -= 1;
            displayPage();
        }

        protected override void howToSearchFilesNextBtn_Click(object sender, EventArgs e)
        {
            if (currentPage == maxPage)
            {
                displayLastPageControls();
            }
            else
            {
                displayNormalPageControls();
            }
            currentPage += 1;
            displayPage();
        }

        protected override void displayPage()
        {
            switch (currentPage)
            {
                case 1:
                    this.searchFilesStep1Label.Text = "Step " + currentPage + ": Select \"Merge Files\" tab";
                    this.selectSearchFilesTabPictureBox.Image = global::ExtractFiles.Properties.Resources.howtomergefilestab;
                    this.howToSearchFilesInstructionBox.Text = "Step " + currentPage + ": Select the \"Merge Files\" tab to merge multiple files from the same parent directory into a single file.\n\nClick \"Next\" to continue.";
                    break;
                case 2:
                    this.searchFilesStep1Label.Text = "Step " + currentPage + ": Browse for source directory";
                    this.selectSearchFilesTabPictureBox.Image = global::ExtractFiles.Properties.Resources.howtomergefilessrcdir;
                    this.howToSearchFilesInstructionBox.Text = "Step " + currentPage + ": Browse for the directory which contains the files to merge.\n\nClick \"Next\" to continue.";
                    break;
                case 3:
                    this.searchFilesStep1Label.Text = "Step " + currentPage + ": Browse for file to store merged content";
                    this.selectSearchFilesTabPictureBox.Image = global::ExtractFiles.Properties.Resources.howtomergefilesdestfile;
                    this.howToSearchFilesInstructionBox.Text = "Step " + currentPage + ": Browse for the file to contain the merged content. The file must be created first to be selected.\n\nClick \"Next\" to continue.";
                    break;
                case 4:
                    this.searchFilesStep1Label.Text = "Step " + currentPage + ": Set the line break style";
                    this.selectSearchFilesTabPictureBox.Image = global::ExtractFiles.Properties.Resources.howtomergefileslinestyle;
                    this.howToSearchFilesInstructionBox.Text = "Step " + currentPage + ": You may find it useful to insert a line break of a certain style at the end of the content of each file you merge. Currently, we support empty line or file name to separate different file content.\n\nClick \"Next\" to continue.";
                    break;
                case 5:
                    this.searchFilesStep1Label.Text = "Step " + currentPage + ": Set the backup option";
                    this.selectSearchFilesTabPictureBox.Image = global::ExtractFiles.Properties.Resources.howtomergefilesbackup;
                    this.howToSearchFilesInstructionBox.Text = "Step " + currentPage + ": You may be merging the files to a single destination file which was previously created. You can either overwrite the content with a new merge, or choose to let us back up your existing file, so that you can revert to it if any goes wrong with the new merge. However, if there is already a backup file in the same directory, the backup file will be overwritten with the existing main copy content. So it is good to change the file name of the backup file previously created if you still wish to keep it.\n\nClick \"Next\" to continue.";
                    break;
                case 6:
                    this.searchFilesStep1Label.Text = "Step " + currentPage + ": Set the filter of the file types to merge";
                    this.selectSearchFilesTabPictureBox.Image = global::ExtractFiles.Properties.Resources.howtosearchfilesfilter;
                    this.howToSearchFilesInstructionBox.Text = "Step " + currentPage + ": Indicate the filter of the file type to merge. You can include multiple filters if you are merging different file types. Deliminate each filter with a comma (,), so do not include a comma in the filter itself.\n\nClick \"Next\" to continue.";
                    break;
                case 7:
                    this.searchFilesStep1Label.Text = "Step " + currentPage + ": Merge now!";
                    this.selectSearchFilesTabPictureBox.Image = global::ExtractFiles.Properties.Resources.howtomergefilesmergebtn;
                    this.howToSearchFilesInstructionBox.Text = "Step " + currentPage + ": Click the \"Merge\" button and a list of result will be populated in the list box above.";
                    break;
            }
        }
    }
}
